import { MockMethod } from 'vite-plugin-mock'
import { responseSuccess } from './_util'

const icons = [
  {
    baseConfig: {
      name: 'order'
    },
    components: [
      {
        id: 'ff2d1a0d-a00e-4203-bfb8-bfefd1bdec9e',
        type: 'path',
        fill: 'currentColor',
        stroke: 'currentColor',
        'stroke-width': 0,
        d: 'M288 352.256l448 0c17.664 0 32-14.336 32-32s-14.336-32-32-32L288 288.256c-17.664 0-32 14.336-32 32S270.336 352.256 288 352.256L288 352.256zM736 479.744 288 479.744c-17.664 0-32 14.336-32 32 0 17.664 14.336 32 32 32l448 0c17.664 0 32-14.336 32-32C768 494.08 753.664 479.744 736 479.744L736 479.744zM736 671.744 288 671.744c-17.664 0-32 14.336-32 32 0 17.664 14.336 32 32 32l448 0c17.664 0 32-14.336 32-32C768 686.08 753.664 671.744 736 671.744L736 671.744zM418.688 160l160 0c26.528 0 48-21.504 48-48 0-26.496-21.504-48-48-48l-160 0c-26.496 0-48 21.504-48 48C370.688 138.496 392.192 160 418.688 160L418.688 160zM832 96l-32 0c-17.664 0-32 14.336-32 32 0 17.664 14.336 32 32 32l32 0c35.296 0 64 28.704 64 64l0 608c0 35.296-28.704 64-64 64L192 896c-35.296 0-64-28.704-64-64L128 224c0-35.296 28.704-64 64-64l32 0c17.664 0 32-14.336 32-32 0-17.664-14.336-32-32-32L192 96C121.312 96 64 153.312 64 224l0 608c0 70.688 57.312 128 128 128l640 0c70.688 0 128-57.312 128-128L960 224C960 153.312 902.688 96 832 96L832 96zM832 96'
      }
    ]
  }
]

export default [
  {
    url: '/api/icons/:name',
    method: 'get',
    response ({ query }) {
      const name = query.name
      return responseSuccess(icons.find(item => item.baseConfig.name === name))
    }
  }
] as MockMethod[]
